
import com.nttdocomo.ui.Canvas;
import com.nttdocomo.ui.Graphics;
import com.nttdocomo.util.Timer;
import com.nttdocomo.util.TimerListener;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author tsuchimoto
 */
public class View extends Canvas implements TimerListener
{
    private Timer m_Timer;
    private int m_X;

    public View()
    {
        m_Timer=new Timer();
        m_Timer.setTime(100);
        m_Timer.setRepeat(true);
        m_Timer.setListener(this);
        m_Timer.start();
    }

    public void paint(Graphics aGrphics)
    {
        aGrphics.lock();
        aGrphics.clearRect(0, 0, getWidth(), getHeight());
        aGrphics.setColor(Graphics.getColorOfName(Graphics.BLACK));
        aGrphics.fillRect(m_X, 0, 100, 100);
        aGrphics.unlock(true);
    }

    public void timerExpired(Timer timer)
    {
        m_X=(m_X+1)%200;
        repaint();
    }

    public void resume()
    {
        m_Timer.start();
    }

}
